CC		= gcc
CCX		= g++
CCX_OPTIONS	= -O2 -Wall
LIBS		= -lntl -lgmp -lm

poly: nfsinput.o polyselector.cc 
	$(CCX) $(CCX_OPTIONS) polyselector.cc $(LIBS) nfsinput.o -o pgnfs_polyselector

bases: nfsinput.o makebases.cc
	$(CCX) $(CCX_OPTIONS) makebases.cc nfsinput.o $(LIBS) -o pgnfs_makebases

sieve: nfsinput.o sieve.cc
	$(CCX) $(CCX_OPTIONS) sieve.cc nfsinput.o $(LIBS) -o pgnfs_sieve

makerel: make-rel.cc
	$(CCX) $(CCX_OPTIONS) make-rel.cc $(LIBS) -o make-rel

nfsinput.o: nfsinput.h nfsinput.cc
	$(CCX) $(CCX_OPTIONS) -c nfsinput.cc

linear: nfsinput.o linear-algebra.cc 
	$(CCX) $(CCX_OPTIONS) linear-algebra.cc nfsinput.o $(LIBS) -o pgnfs_linearalg

sqrt: nfsinput.o square-root.cc 
	$(CCX) $(CCX_OPTIONS) square-root.cc nfsinput.o $(LIBS) -lginac -o pgnfs_sqrt

primes: sieve2310_64bit.c
	$(CC) -lm sieve2310_64bit.c -o primes

all:	poly bases sieve linear sqrt
clean:
	rm *.o
	rm pgnfs_*
